%%%%%%% DOCUMENT-PROPERTIES
\def\FileTitle{A multi-domain energy profiling system based on perfSONAR}
\def\FileThesisname{GreenSONAR}
\def\FileAuthor{Lutz Engels~$<$\href{mailto:lutz.engels@os3.nl}{Lutz.Engels@os3.nl}$>$ \\Todor Yakimov~$<$\href{mailto:todor.yakimov@os3.nl}{Todor.Yakimov@os3.nl}$>$ \\}
\def\FileUniversity{University of Amsterdam}
\def\FileFaculty{Graduate School of Informatics}
\def\FileDepartment{System and Network Engineering}
\def\FileAddress{Science Park 904 \\1098XH Amsterdam}
\def\FileSupervisor{Dr. Paola Grosso~$<$\href{mailto:p.grosso@uva.nl}{p.grosso@uva.nl}$>$\\Karel van der Veldt~$<$\href{mailto:karel.vd.veldt@uva.nl}{karel.vd.veldt@uva.nl}$>$\\Hao Zhu~$<$\href{mailto:h.zhu@uva.nl}{h.zhu@uva.nl}$>$}
\date{Feb 18, 2013}


\documentclass[a4paper,oneside]{wbook}

%%%%%%% PACKAGES
\usepackage{csvsimple} %for csv-file fun
\usepackage[square,numbers]{natbib}
%\usepackage[hyphens]{url} % no need if hyperref
\PassOptionsToPackage{hyphens}{url}\usepackage[plainpages=true,pdfpagelabels]{hyperref}
\usepackage{wrapfig}
\usepackage{graphicx}
\usepackage{color}
\usepackage{fancybox}
\usepackage{epsfig}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{enumitem} %various bullet types for lists
\usepackage{parallel}
\usepackage[parfill]{parskip}
\setlength\parskip{0.5em}
\usepackage[nottoc]{tocbibind}
\usepackage{bbm}
\usepackage{latexsym}
\usepackage{exscale}
\usepackage{rotating}
\usepackage{times}
\usepackage{fmtcount}
\usepackage{comment}
\usepackage{longtable}
\usepackage[lang=en]{wbook-title} % frontpage layout %
\usepackage{hyperref}
\hypersetup{%
  pdftitle      = {\FileTitle{}},
  pdfsubject    = {\FileDepartment{}},
  pdfkeywords   = {LaTeX, PDF},
  linkcolor     = black,
  filecolor     = black,
  urlcolor      = black,
  citecolor     = black,
  pdfauthor     = {\FileAuthor{}},
  pdfcreator    = {\LaTeX\ with package \flqq hyperref\frqq},
  linktocpage   = true,
  colorlinks    = true
}

\usepackage{listings} % formatting for sourcecode in appendix

\lstset{%
  basicstyle=\scriptsize,
  frame=single, % shadowbox
  showspaces=false,
  showstringspaces=false,
  backgroundcolor=\color{white},
  breaklines=true,
  numbers=left,
  tabsize=2,
  numberstyle=\tiny,
  emphstyle=\bfseries,
  commentstyle=\itshape,
}

%%%%%%% COMMAND (RE)DEFINITIONS
\newcommand{\sidewise}[1]{%
  \begin{sideways}
    #1
  \end{sideways}
}
\newcommand{\sidecomment}[2]{%
  \underbrace{#1}_{\sidewise{#2}}
}
\newcommand{\makefigure}[4]{%
  \begin{figure}[htbp]
    \centering
    \fbox{
      \includegraphics[width=#1\textwidth]{#2}
    }
    \caption{#3}
    \label{#4}
  \end{figure}
}
\newcommand{\makeboximage}[2]{%
  \begin{center}
    \fbox{
      \includegraphics[width=#1\textwidth]{#2}
    }
  \end{center}
}

\def\signed #1{{\leavevmode\unskip\nobreak\hfil\penalty50\hskip2em
  \hbox{}\nobreak\hfil(#1)%
  \parfillskip=0pt \finalhyphendemerits=0 \endgraf}}

\newsavebox\mybox
\newenvironment{aquote}[1]
  {\savebox\mybox{#1}\begin{quote}}
  {\signed{\usebox\mybox}\end{quote}}
\newcommand{\citationnote}[1]{
}

\newcommand{\namesigdate}[2][5cm]{%
  \begin{tabular}{@{}p{#1}@{}}
    \\[2\normalbaselineskip] \hrule \\[0pt]
    {\small \textit{Date}} \\[2\normalbaselineskip] \hrule \\ [0pt]
    {\small \textit{Signature #2}}
  \end{tabular}
}

% Make sure URLs break within margins
\renewcommand{\UrlBreaks}{\do\/\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z}

%%%%%%% DOCUMENT
\begin{document}

\title{\FileTitle}
\author{\FileAuthor}
\thesisname{\FileThesisname}
\university{\FileUniversity}
\faculty{\FileFaculty}
\department{\FileDepartment}
\supervisor{\FileSupervisor}
%\reader{\FileReader}

\addr{\FileAddress}
\logo{Figures/uva-logo}

\maketitle
\setcounter{page}{1}
\pagenumbering{roman}

\tableofcontents
\newpage

%%%%%%% CONTENT: Please refer to the according .tex files in the content directory.
% \chapter{Abstract}
% \input{content/abstract}

\chapter{Introduction}
% set the page numbers to be arabic, starting at page 1 %
\setcounter{page}{1}
\pagenumbering{arabic}
\input{content/introduction}

\chapter{Energy Profiling}
\label{sec:energy_profiling}
\input{content/energy_profiling}
	
	\chapter{Metrics}
	\label{sec:metrics}
	\input{content/metrics}

	\chapter{perfSONAR}
	\label{sec:perfsonar}
	\input{content/perfsonar}

	\chapter{GreenSONAR}
	\label{sec:greensonar}
	\input{content/greensonar}

	\chapter{Results}
	\label{sec:results}
	\input{content/results.tex}

	\chapter{Conclusion}
	\label{sec:conclusion}
	\input{content/conclusion}

	\chapter{Acknowledgments}
	\input{content/acknowledgment}

	
%%%%%%% BIBLIOGRAPHY
%	\nocite{*} % Even show uncited entries
	\bibliographystyle{authordate1}
	\bibliography{report}

%%%%%%% APPENDIX
	\appendix

	\chapter{Abbreviations}
	\label{app:acronyms}
	\input{content/acronyms}


	\chapter{Test data}
	\label{app:data}
	\input{content/data}

	\chapter{Code listings}
	\label{app:ma_extension}
	The following code snipplets are also available online at:
	\vskip2em
	\href{http://code.google.com/p/greensonar/source/browse/\#svn\%2Ftrunk\%2Fcode}{http://code.google.com/p/greensonar/source/browse/\#svn\%2Ftrunk\%2Fcode}
	\vskip2em
	The files in the perfSONARNC folder offer a complete release that can be deployed by running the "pncs" PHP file part of the main folder. In order to simulate test results, one can use the following
	queries. Further information can be found on the perfSONARNC website:
	queries. Further information can be found on the perfSONARNC website:
	\vskip2em
	\href{https://trac.uninett.no/perfsonarnc}{https://trac.uninett.no/perfsonarnc} 
	\vskip2em
	Reading out the available Measurement Archives can be done with the following query:
	\begin{lstlisting}[basicstyle=\scriptsize]
		code/perfSONARNC/maquery/maquery.php -q "//pn:ma/pn:name" localhost

	\end{lstlisting}
	\vskip2em
	Queries for reading out Measurement Archives:
	\begin{lstlisting}[basicstyle=\scriptsize]
		code/perfSONARNC/maquery/maquery.php -r 1 192.168.1.1_snmp snmp table standard -o 1 localhost -f "2013-02-06 09:00" -t "2013-02-06 09:10"
		
		code/perfSONARNC/maquery/maquery.php -r 1 192.168.1.1_pdu pdu table standard -o 1 localhost -f "2013-02-06 09:00" -t "2013-02-06 09:10"
	\end{lstlisting}
	\vskip2em
	SNMP Measurement Archive listing:
	\lstinputlisting[language=XML, title=snmpma1.class.php]{../code/perfSONARNC/snmpma1/snmpma1.class.php}
	\vskip2em
	RRD Measurement Archive listing:
	\lstinputlisting[language=XML, title=pduma1.class.php]{../code/perfSONARNC/pduma1/pduma1.class.php}
	\vskip2em
	Script that gathers interface utilization by using SNMP:
	\lstinputlisting[language=bash, title=interface\_percentage\_utilization.sh]{../code/perfSONARNC/snmpma1/interface_percentage_utilization.sh}
	
\end{document}
